package com.example.demo.controller;

import org.springframework.web.bind.annotation.*;

/**
 * @version : 1.0
 * 撸代码前，多思考一点
 * @author: pengzx
 * @Description:
 * @date: 11:02 2018/5/31
 */
@RestController
@RequestMapping(value = "/hello")
public class DemoController {

    /**
     * 路径参数
     * http://localhost:8080/hello/world
     * @param hello
     * @return
     */
    @RequestMapping(value = "/{world}", method = RequestMethod.GET)
    public String demoURL(@PathVariable(name = "world") String hello)
    {
        return "path->" + hello;
    }

    /**
     * 请求参数
     * http://localhost:8080/hello/param?param=world
     * @param hello
     * @return
     */
    @RequestMapping(value = "/param",method = RequestMethod.GET)
    public String demoParam(@RequestParam(name = "param") String hello)
    {
        return "param->" + hello;
    }
}
